#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <stdlib.h>
using namespace std;


int GetMonth(int _year, int _month) {
    int arr[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    if (_month == 2 && (_year % 4 == 0 && _year % 100 != 0) || _year % 400 == 0) {
        return 29;
    }
    return arr[_month];
}
int leap_year(int year) {
    if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
        return 1;
    }
    else {
        return 0;
    }
}
int main() {
    int days1, days2;
    while (cin >> days1 >> days2) {
        int ret1 = 0, ret2 = 0;
        int year1 = days1 / 10000;
        int tmp = days1 % 10000;
        int day = tmp % 100;
        int month = tmp / 100;
        for (int i = 1; i < month; i++) {
            ret1 += GetMonth(year1, i);
        }
        ret1 += day;
        int year2 = days2 / 10000;
        tmp = days2 % 10000;
        day = tmp % 100;
        month = tmp / 100;
        for (int i = 1; i < month; i++) {
            ret2 += GetMonth(year2, i);
        }
        ret2 += day;
        if (year1 > year2) {
            if (ret1 > ret2) {
                ret1 += (ret1 - ret2);
                for (int i = year2; i < year1; i++) {
                    ret1 += 365;
                    if (leap_year(i) == 1) {
                        ret1 += 1;
                    }
                }
            }
            else {
                ret1 -= (ret2 - ret1);
                for (int i = year2; i < year1; i++) {
                    ret1 += 365;
                    if (leap_year(i) == 1) {
                        ret1 += 1;
                    }
                }
            }
            cout << ret1 - ret2 << endl;
        }
        else if (year2 > year1) {
            if (ret1 > ret2) {
                ret2 -= (ret1 - ret2);
                for (int i = year1; i < year2; i++) {
                    ret2 += 365;
                    if (leap_year(i) == 1) {
                        ret2 += 1;
                    }
                }
            }
            else {
                ret2 += (ret2 - ret1);
                for (int i = year1; i < year2; i++) {
                    ret2 += 365;
                    if (leap_year(i) == 1) {
                        ret2 += 1;
                    }
                }
            }
            cout << ret2 - ret1 << endl;
        }
        else
            cout << abs(ret1 - ret2) + 1 << endl;
    }

    return 0;
}